package com.daoeping.action;

import java.util.ArrayList;
import java.util.List;

import com.daoeping.data.Bsc_idcardtype;
import com.daoeping.data.Bsc_worktype;
import com.daoeping.domain.JsonData;
import com.daoeping.service.Bsc_worktypeService;
import com.daoeping.util.ConverntJsonData;
import com.opensymphony.xwork2.ActionSupport;

public class Bsc_worktypeAction extends ActionSupport{
	
	private static final long serialVersionUID = -5456090727809792720L;
	private Bsc_worktypeService bsc_worktypeService;
	private JsonData jsonData;
	private List<Bsc_worktype> bsc_worktypeList;
	
	public Bsc_worktypeService getBsc_worktypeService() {
		return bsc_worktypeService;
	}

	public void setBsc_worktypeService(Bsc_worktypeService bsc_worktypeService) {
		this.bsc_worktypeService = bsc_worktypeService;
	}

	public List<Bsc_worktype> getBsc_worktypeList() {
		return bsc_worktypeList;
	}

	public void setBsc_worktypeList(List<Bsc_worktype> bsc_worktypeList) {
		this.bsc_worktypeList = bsc_worktypeList;
	}

	public JsonData getJsonData() {
		return jsonData;
	}

	public void setJsonData(JsonData jsonData) {
		this.jsonData = jsonData;
	}

	

	public String findAllWorkType(){
		jsonData = new JsonData();
		bsc_worktypeList = bsc_worktypeService.findBsc_worktypeList();
		List <String[]> strList = new ArrayList<String[]>();
		for (Bsc_worktype bsc_worktype : bsc_worktypeList) {
			String [] strarr = new String[2];
			strarr[1] = bsc_worktype.getId()+"";
			strarr[0] = bsc_worktype.getName();
			strList.add(strarr);
		}
		jsonData.setJsonData( new ConverntJsonData().getJsonData(strList)+"");
		return "allworktype";
		
	}
	
	public List<Bsc_worktype> findBsc_worktypeList(){
		return this.bsc_worktypeService.findBsc_worktypeList();
	} 
}
